package com.agileboot.domain.system.dict.db;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * <p>
 * 字典类型表 Mapper 接口
 * </p>
 *
 * @author valarchie
 * @since 2024-10-12
 */
public interface SysDictTypeMapper extends BaseMapper<SysDictTypeEntity> {
    /**
     * 筛选sys_dict_type表中的dict_type在sys_dict_data表中存在多少条数据，没有返回0
     * @param dictType
     * @return
     */
    @Select("SELECT COUNT(d.dict_type) "
            + "FROM sys_dict_type t "
            + "LEFT JOIN sys_dict_data d ON t.dict_type = d.dict_type "
            + "WHERE t.dict_type = #{dictType}")
    int countDictDataByType(String dictType);
}
